package com.linuxgt.web.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

/**
 * 配置文件工具类
 * Created by liuteng on 2016/11/25.
 */
public final class PropertiesUtils {

    private MyReloadableResourceBundleMessageSource message;
    Logger log = LoggerFactory.getLogger(getClass());

    public void setMessage(MyReloadableResourceBundleMessageSource message) {
        this.message = message;
    }

    /**
     * 获取配置项配置内容
     * @param code 配置项
     * @return 配置内容
     */
    public String getMessage(String code) {
        log.debug("正在从配置文件获取【{}】配置项。",code);
        return message.getMessage(code, null, null);
    }
}
